package com.cosina.game.crystallight.ui.menu;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Point;

import com.cosina.game.crystallight.CrystalLightActivity;
import com.cosina.game.crystallight.MediaPlayerAdapter;
import com.cosina.game.crystallight.ui.ResourceManager;
import com.cosina.game.crystallight.ui.ResourceReference;
import com.cosina.game.crystallight.ui.menu.transform.FlyTransform;
import com.cosina.game.crystallight.ui.menu.transform.TransformSuite;
import com.cosina.game.crystallight.ui.menu.util.ViewPart;
import com.cosina.game.crystallight.util.World;

public class CreditsView extends CompositeView {

	public CreditsView(CrystalLightActivity activity) {
		super(activity);
		this.setClickable(false);
		{
			Bitmap bitmap = ResourceManager.get(ResourceReference.IMG_MENU_CREDITS);
			
			FlyTransform ft = new FlyTransform();
			ft.setFrom(World.BOTTOM);
			TransformSuite ts = TransformSuite.create(ft);
			
			Point leftTop = new Point(31,130);
			ViewPart viewPart = new ViewPart(1,this, bitmap, leftTop,ts);
			viewParts.add(viewPart);
		}
		{
			Bitmap bitmap = ResourceManager.get(ResourceReference.IMG_MENU_BUT_MAIN_MENU);
			Point leftTop = new Point(105,420);
			ViewPart viewPart = new ViewPart(MAIN_MENU_ID,this, bitmap, leftTop);
			viewParts.add(viewPart);
		}
		MediaPlayerAdapter.menuRoll();
	}

	
	private static final int MAIN_MENU_ID  =  2; 
	
	@Override
	public void onButtonClicked(int id) {
		
		switch (id) {
			case MAIN_MENU_ID:
				MediaPlayerAdapter.menuBtnclick();
				activity.doShowMenu();
		}
	}
	
	
	@Override
	protected void onDraw(Canvas canvas) {
		super.onDraw(canvas);
		this.invalidate();
	}
}
